LanguageExt.Core

LanguageExt.Core Monads Alternative Value Monads TryT

Contents

record TryT <M, A> (Func<K<M, Fin<A>>> runTry) Source #

where M : Monad<M>

TryT monad transformer, which allows for an optional result.

Parameters

type M

Given monad trait

type A

Bound value type

param runEither

Transducer that represents the transformer operation

Methods

method TryT<M, A> Succ (A value) Source #

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

TryT

method TryT<M, A> Fail (Error value) Source #

Lift a fail value into the monad-transformer

Parameters

param value

Value to lift

returns

TryT

method TryT<M, A> Lift (Pure<A> pure) Source #

Lifts a given monad into the transformer

Parameters

param pure

Monad to lift

returns

TryT

method TryT<M, A> Lift (Fin<A> result) Source #

Lifts a given monad into the transformer

Parameters

param either

Monad to lift

returns

TryT

method TryT<M, A> Lift (Func<Fin<A>> result) Source #

Lifts a given monad into the transformer

Parameters

param either

Monad to lift

returns

TryT

method TryT<M, A> Lift (Fail<Error> fail) Source #

Lifts a given monad into the transformer

Parameters

param fail

Monad to lift

returns

TryT

method TryT<M, A> Lift (K<M, A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

TryT

method TryT<M, A> LiftIO (IO<A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

TryT

method K<M, B> Match <B> (Func<A, B> Succ, Func<Error, B> Fail) Source #

Match the bound value and return a result (which gets packages back up inside the inner monad)

Parameters

param Succ

Success branch

param Fail

Fail branch

returns

Inner monad with the result of the Succ or Fail branches

method K<M, Fin<A>> Run () Source #

Run the transformer

This is where the exceptions are caught

method TryT<M1, B> MapT <M1, B> (Func<K<M, Fin<A>>, K<M1, Fin<B>>> f) Source #

where M1 : Monad<M1>

Maps the bound monad

Parameters

type M1

Target monad type

type B

Target bound value type

param f

Mapping function

returns

Mapped monad

method TryT<M, B> MapM <B> (Func<K<M, A>, K<M, B>> f) Source #

Maps the given monad

Parameters

param f

Mapping function

method TryT<M, B> Map <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method TryT<M, B> Select <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping transducer

returns

TryT

method TryT<M, B> Bind <B> (Func<A, K<TryT<M>, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method TryT<M, B> Bind <B> (Func<A, TryT<M, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method TryT<M, B> Bind <B> (Func<A, IO<B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method TryT<M, B> Bind <B> (Func<A, Pure<B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, K<TryT<M>, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, TryT<M, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, K<M, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, Fin<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, C> SelectMany <B, C> (Func<A, IO<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

class TryTExt Source #

Either monad extensions

Methods

method TryT<M, A> As <M, A> (this K<TryT<M>, A> ma) Source #

where M : Monad<M>

method TryT<M, A> Flatten <M, A> (this TryT<M, TryT<M, A>> mma) Source #

where M : Monad<M>

Monadic join

method TryT<M, C> SelectMany <M, A, B, C> ( this K<M, A> ma, Func<A, K<TryT<M>, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, C> SelectMany <M, A, B, C> ( this K<M, A> ma, Func<A, TryT<M, B>> bind, Func<A, B, C> project) Source #

where M : Monad<M>

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

TryT

method TryT<M, B> Apply <M, A, B> (this TryT<M, Func<A, B>> mf, TryT<M, A> ma) Source #

where M : Monad<M>

Applicative apply

method TryT<M, B> Action <M, A, B> (this TryT<M, A> ma, TryT<M, B> mb) Source #

where M : Monad<M>

Applicative action

class TryT <M> Source #

Methods

method TryT<M, A> Succ <A> (A value) Source #

method TryT<M, A> Fail <A> (Error value) Source #

method TryT<M, A> lift <A> (Func<Fin<A>> ma) Source #

method TryT<M, A> lift <A> (Fin<A> ma) Source #

method TryT<M, A> lift <A> (Pure<A> ma) Source #

method TryT<M, A> lift <A> (Fail<Error> ma) Source #

method TryT<M, A> lift <A> (Error ma) Source #

method TryT<M, A> liftIO <A> (IO<A> ma) Source #

class TryT Source #

Methods

method TryT<M, B> bind <M, A, B> (TryT<M, A> ma, Func<A, TryT<M, B>> f) Source #

where M : Monad<M>

method TryT<M, B> map <M, A, B> (Func<A, B> f, TryT<M, A> ma) Source #

where M : Monad<M>

method TryT<M, A> Succ <M, A> (A value) Source #

where M : Monad<M>

method TryT<M, A> Fail <M, A> (Error value) Source #

where M : Monad<M>

method TryT<M, B> apply <M, A, B> (TryT<M, Func<A, B>> mf, TryT<M, A> ma) Source #

where M : Monad<M>

method TryT<M, B> action <M, A, B> (TryT<M, A> ma, TryT<M, B> mb) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Func<Fin<A>> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Fin<A> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (K<M, A> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Pure<A> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Fail<Error> ma) Source #

where M : Monad<M>

method TryT<M, A> lift <M, A> (Error ma) Source #

where M : Monad<M>

method TryT<M, A> liftIO <M, A> (IO<A> ma) Source #

where M : Monad<M>

method K<M, B> match <M, A, B> (TryT<M, A> ma, Func<A, B> Succ, Func<Error, B> Fail) Source #

where M : Monad<M>

class TryT <M> Source #

where M : Monad<M>

Trait implementation for TryT

Parameters

type M

Given monad trait